(* A compiler avec ocamlopt, puis a utiliser en pipe *)

open Bplib
let args = Array.to_list Sys.argv;;
let args_assoc = assoc_of_sys_argv Sys.argv;;
let get_arg_int_value = try_get_arg_int_value args_assoc;;
let get_arg_string_value = try_get_arg_string_value args_assoc;;
 let _f = get_arg_int_value "-f"

let minuit = List.mem "-m" args;;

(* On peut instancier l'objet *)
let pause = new Bplib.sleeper (1./.(float_of_int _f)) minuit;;

let _ =
  try
    while true do
      let line = input_line stdin in
      pause#sleep;
      print_endline line
    done
  with
  | End_of_file -> ()
